﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace SHS_SE
{
    public partial class SMatrixForm : Form
    {
        public SMatrixForm(string[] h)
        {
            InitializeComponent();
            headers = h;
        }

        private float[,] s = null;
        public float[,] S { set { s = value; } }
        private string[] headers = null;

        private void SMatrixForm_Load(object sender, EventArgs e)
        {
            DataTable dt = new DataTable();

            for (int i = 0; i < s.GetLength(0); i++)
            {
                dt.Columns.Add(headers[i]);                
            }

            for (int i = 0; i < s.GetLength(0); i++)
            {
                float[] r = new float[s.GetLength(0)];
                for (int j = 0; j < r.Length; j++)
                {
                    r[j] = s[i, j];
                }

                dt.Rows.Add(r.Select(it => it.ToString()).ToArray());
            }

            dataGridView1.DataSource = dt;
        }
    }
}
